package org.lanqiao.tjut.action;

import java.util.List;

import javax.annotation.Resource;

import org.lanqiao.tjut.bean.PowerBean;
import org.lanqiao.tjut.service.IPowerInfoService;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

@Controller
public class PowerInfoAction {
	// 注入Service
		@Resource
		private IPowerInfoService powS;
		@RequestMapping("/insertPowerAction")
		public String insert(PowerBean powB) {
			int i = powS.insert(powB);
			if (i > 0) {
				return "powerInfoManager/powerInfoAddDetail";
			}
			return "error";
		}
		
		@ResponseBody // 表示该方法是进行ajax响应处理
		@RequestMapping("/selectPowerInfoByParams")
		public List<PowerBean> selectPowerInfoByParams(PowerBean powB) {
			// 调用service进行数据库查询操作
			List<PowerBean> lstPowS = powS.selectPowerInfoByParams(powB);
			return lstPowS;
		}

}
